package com.example.day_blog.config;

import com.example.day_blog.common.Constants;
import com.example.day_blog.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author starsea
 * @date 2024-01-18 16:22
 */
@ControllerAdvice
public class ErrorAdvice  {
    @ExceptionHandler
    public Result errorHandler(Exception e)
    {
        Result result=new Result();
        result.setErrMsg("内部发生错误，请联系管理员");
        result.setCode(Constants.RESULT_FAIL);
        return result;
    }
}
